import { BasicColumn, FormSchema } from "/@/components/Table"
import { DescItem } from "/@/components/Description/index"
import { render } from "/@/utils/common/renderUtils"
import { rules } from "/@/utils/helper/validator"

export enum VerifyStatus {
  VERIFY = "2",
  NO_VERIFY = "1",
}

export enum ReceiverType {
  // 接收人为会员, 代码中可以指定任何会员
  MEMBER = "1",
  // 接收人指定为管理员
  ADMIN = "2",
}

export const columns: BasicColumn[] = [
  {
    title: "姓名",
    dataIndex: "name",
    slots: { customRender: "name" },
    width: 100,
  },
  {
    title: "手机号",
    dataIndex: "phone",
    slots: { customRender: "phone" },
    width: 120,
  },
  {
    title: "邮箱",
    dataIndex: "email",
    slots: { customRender: "email" },
    width: 150,
  },
  {
    title: "备注",
    dataIndex: "remark",
    width: 100,
  },
  {
    title: "创建时间",
    dataIndex: "createdAt",
    width: 160,
  },
]

export const receiverSubscribeColumns : BasicColumn[] = [
  {
    title: "消息模板",
    dataIndex: "name",
    align: "left",
    width: 80,
  },
  {
    title: "消息渠道",
    // 支持的渠道名称, 多个之间用/隔开
    dataIndex: "channelNames",
    width: 80,
  },
]

export const searchFormSchema: FormSchema[] = [
  {
    field: "keyWord",
    label: "用户",
    component: "Input",
    componentProps: {
      placeholder: "姓名/手机号/邮箱",
    },
  },
]

/**
 * 角色用户搜索form
 */
export const searchUserFormSchema: FormSchema[] = [
  {
    field: "keyWord",
    label: "",
    component: "Input",
    componentProps: {
      placeholder: "消息通知编码/名称",
    },
    colProps: { span: 12 },
  },
]

export const formSchema: FormSchema[] = [
  {
    field: "id",
    label: "",
    component: "Input",
    show: false,
  },
  {
    field: "name",
    label: "姓名",
    required: true,
    component: "Input"
  },
  {
    label: "邮箱",
    field: "email",
    component: "Input"
  },
  {
    label: "手机号",
    field: "phone",
    component: "Input"
  },

  {
    field: "wxMpOpenId",
    label: "微信公众号",
    required: false,
    slot: "wxMpOpenId",
    component: "Input",
  },
  {
    field: "wxMpQrCodeUrl",
    label: "微信公众号二维码",
    required: false,
    show: false,
    component: "Input",
  },
  {
    label: "备注",
    field: "remark",
    component: "InputTextArea",
    componentProps: {
      placeholder: "请输入备注",
      rows: 5,
    },
  },
]

export const formRolePermissionSchema: FormSchema[] = [
  {
    label: "场景",
    field: "sceneCode",
    component: "ApiSelect",
  },
]

export const formDetailSchema: DescItem[] = [
  {
    field: "name",
    label: "姓名",
  },
  {
    field: "email",
    label: "邮箱",
  },
  {
    field: "phone",
    label: "手机",
  },
  {
    field: "wxMpOpenId",
    label: "微信公众号",
  },
  {
    field: "qyWxOpenId",
    label: "企业微信",
  },
  {
    label: "备注",
    labelMinWidth: 60,
    field: "remark",
  },
]
